package org.lqq.entity;

/**
 * Created by 李清泉 on 2017/10/26.
 *
 * @remark
 */
public class DefaultServerAddress implements ServerAddress {

    private String name;//服务名


    private int port;//所有端口

    private String host;//封装成host地址

    private String reqBaseUrl;

    public DefaultServerAddress() {

    }

    public DefaultServerAddress(String name, int port, String host) {
        this.name = name;
        this.port = port;
        this.host = host;
    }

    @Override
    public String getReqBaseUrl() {
        if (reqBaseUrl == null) {
            reqBaseUrl = "http://" + host + ":" + port;
        }
        return reqBaseUrl;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getHost() {

        return host;
    }

    public void setHost(String host) {

        this.host = host;
    }

    @Override
    public int hashCode() {
        return (name+host+port).hashCode();
    }
}
